#include "ticket_cache.h"

#include <string>
#include "base/curl_client.h"
#include "base/read_write_lock.h"

namespace sns {
using namespace std;

string TicketCache::Get(int32_t uid) const {
  base::ReadLock rlock(&mutex_);
  map<int32_t, string>::const_iterator it = sessions_.find(uid);
  if (it != sessions_.end()) {
    return it->second;
  }
  return string();
}

void TicketCache::Set(int32_t uid, const string & session) {
  base::WriteLock wlock(&mutex_);
  sessions_[uid] = session;
}

}

